package com.example.steveaoblogdemo.interceptor;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;



@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    public void addInterceptors(InterceptorRegistry registry){
        InterceptorRegistration inter =  registry.addInterceptor(new LoginInterceptor());
        inter.addPathPatterns("/**");
        //放行地址;登录请求访问路径
        inter.excludePathPatterns("/articles/**");
        inter.excludePathPatterns("/category/**");
        inter.excludePathPatterns("/tag/**");
        inter.excludePathPatterns("/comment/**");
        inter.excludePathPatterns("/email/**");
        inter.excludePathPatterns("/friend/**");
        inter.excludePathPatterns("/user/**");
        inter.excludePathPatterns("/qiNiu/uploadImage");
    }

}
